<template>
	<div>
		<Citydetails
		:azstr="azstr"
		></Citydetails>
		<Cityz 
		:citiess="cities"
		v-on:azchange="fromazstr"
		></Cityz>
	</div>
</template>

<script>
	import Citydetails from './Citydetails'
	import Cityz from './Cityz'
	import axios from 'axios'
	export default {
		data() {
			return {
				cities:[],
				azstr:""
			};
		},
		components: {
			Citydetails,
			Cityz
		},
		methods: {
			getCitydata() {
				// 两个参数,一个是地址,第二是回调函数，与.then 相同
				axios.get("/api/city.json")
				.then(res=>{
					this.cities = res.data.data.cities
					// console.log(this.cities)
				})
			},
			getHomedataBack() {
				// console.log(res)
			},
			fromazstr(str){
				this.azstr = str
				// console.log(this.azarr)
				
			}
		},
		mounted() {
			this.getCitydata()
			// console.log(this.$refs.city)
		}
	}
</script>

<style>

</style>